<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改管理员资料</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="${ctx }/js/common.js"></script>
<script type="text/javascript">

function closeWin(){
	art.dialog.close();
}

function modifyUserinfo(){

	  var username = $("#username").val().trim();
	  if( username  ==  ""){
		  $("#username").focus();
		  alert("用户姓名不能为空。");
		  return false;
	  }

	  var mobile = $("#mobile").val().trim();
	  if(!checkMobilePhone(mobile)){
		    $("#mobile").focus();
			return false;
	  }
	  
	  var telphone = $("#telphone").val().trim();
	  if(telphone != "" && !IsInt(telphone)){
		  	$("#telphone").val("");
		    $("#telphone").focus();
			alert("固定电话号码格式不正确。");
			return false;
	  }

	  var emailAddress = $("#emailAddress").val().trim();
	  var emailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
	  if(emailAddress != "" && !emailReg.test(emailAddress)){
		  $("#emailAddress").focus();
		  alert("电子邮箱格式不正确。");
		  return false;
	  }

	  var address = $("#address").val().trim();
	  if( address  ==  ""){
		  $("#address").focus();
		  alert("通信地址不能为空。");
		  return false;
	  }
	  
	  if(window.confirm("您确认修改该管理员资料吗？")){
		  $("#userForm").submit();
	  }
	  
	  closeWin();
}

</script>
</head>
<body>

<form action="${ctx }/security/user!save.do" method="post" id="userForm" name="userForm">
<table width="750" align="center" cellpadding="0" cellspacing="0" class="tbl_detail" style="margin:30px 0px 20px 0px;">
	<tr>
		<td colspan="100%" bgcolor="#CDE1ED" height="35" align="center" style="font-size: 14px;">修改管理员资料</td>
	</tr>
	<tr>
		<td width="20%" height="30" align="right">姓名：</td>
		<td align="left" style="padding-left: 10px"><input type="text" name="userInfo.username" value="${userInfo.username }" id="username"></td>
	</tr>
	<tr>
		<td height="30" align="right">手机号码：</td>
		<td align="left" style="padding-left: 10px">
		<input type="text" name="userInfo.mobile" value="${userInfo.mobile }" id="mobile"></td>
	</tr>
	<tr>
		<td height="30" align="right">固定电话：</td>
		<td align="left" style="padding-left: 10px"> <input type="text" name="userInfo.telphone" value="${userInfo.telphone }" id="telphone"></td>
	</tr>
	<tr>
		<td height="30" align="right">电子邮箱：</td>
		<td align="left" style="padding-left: 10px"> <input type="text" name="userInfo.emailAddress" value="${userInfo.emailAddress }" id="emailAddress"></td>
	</tr>
	<tr>
		<td height="30" align="right">通信地址：</td>
		<td align="left" style="padding-left: 10px"> 
		<input name="userInfo.address" type="text" size="40" value="${userInfo.address }" id="address">
		
		<!-- 隐藏域 begin  -->
          <input name="userInfo.id" type="hidden" value="${userInfo.id }"/>
        <!-- 隐藏域  end  -->        
		</td>
	</tr>
	<tr>
		<td align="center" colspan="100%" height="30">
		 <input type="button" value="保存" onclick="javascript:modifyUserinfo()">&nbsp;&nbsp;<input type="button" value="关闭" onclick="closeWin()" /></td>
	</tr>
</table>
</form>

</body>
</html>